{
  "title": "ExtensionDoorhanger",
  "description": "A template with a heading, addon icon, title and description. No markup allowed.",
  "version": "1.0.0",
  "type": "object",
  "definitions": {
    "plainText": {
      "description": "Plain text (no HTML allowed)",
      "type": "string"
    },
    "linkUrl": {
      "description": "Target for links or buttons",
      "type": "string",
      "format": "uri"
    }
  },
  "properties": {
    "category": {
      "type": "string",
      "description": "Attribute used for different groups of messages from the same provider"
    },
    "bucket_id": {
      "type": "string",
      "description": "A bucket identifier for the addon. This is used in order to anonymize telemetry for history-sensitive targeting."
    },
    "notification_text": {
      "description": "The text in the small blue chicklet that appears in the URL bar. This can be a reference to a localized string in Firefox or just a plain string.",
      "oneOf": [
        {
          "type": "string",
          "description": "Message shown in the location bar notification."
        },
        {
          "type": "object",
          "properties": {
            "string_id": {
              "type": "string",
              "description": "Id of localized string for the location bar notification."
            }
          },
          "required": ["string_id"]
        }
      ]
    },
    "info_icon": {
      "type": "object",
      "description": "The small icon displayed in the top right corner of the pop-over. Should be 19x19px, svg or png. Defaults to a small question mark." ,
      "properties": {
        "label": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "attributes": {
                  "type": "object",
                  "properties": {
                    "tooltiptext": {
                      "type": "string",
                      "description": "Text for button tooltip used to provide information about the doorhanger."
                    }
                  },
                  "required": ["tooltiptext"]
                }
              },
              "required": ["attributes"]
            },
            {
              "type": "object",
              "properties": {
                "string_id": {
                  "type": "string",
                  "description": "Id of localized string used to provide information about the doorhanger."
                }
              },
              "required": ["string_id"]
            }
          ]
        },
        "sumo_path": {
          "type": "string",
          "description": "Last part of the path in the URL to the support page with the information about the doorhanger.",
          "examples": ["extensionpromotions", "extensionrecommendations"]
        }
      }
    },
    "heading_text": {
      "description": "The larger heading text displayed in the pop-over. This can be a reference to a localized string in Firefox or just a plain string.",
      "oneOf": [
        {
          "type": "string",
          "description": "The message displayed in the title of the extension doorhanger"
        },
        {
          "type": "object",
          "properties": {
            "string_id": {
              "type": "string"
            }
          },
          "required": ["string_id"],
          "description": "Id of localized string for extension doorhanger title"
        }
      ]
    },
    "addon": {
      "description": "Addon information including AMO URL.",
      "type": "object",
      "properties": {
        "id": {
          "allOf": [
            {"$ref": "#/definitions/plainText"},
            {"description": "Unique addon ID"}
          ]
        },
        "title": {
          "allOf": [
            {"$ref": "#/definitions/plainText"},
            {"description": "Addon name"}
          ]
        },
        "author": {
          "allOf": [
            {"$ref": "#/definitions/plainText"},
            {"description": "Addon author"}
          ]
        },
        "icon": {
          "description": "The icon displayed in the pop-over. Should be 64x64px and png/svg.",
          "allOf": [
            {"$ref": "#/definitions/linkUrl"},
            {"description": "Addon icon"}
          ]
        },
        "rating": {
          "type": "number",
          "minimum": 0,
          "maximum": 5,
          "description": "Star rating"
        },
        "users": {
          "type": "integer",
          "minimum": 0,
          "description": "Installed users"
        },
        "amo_url": {
          "allOf": [
            {"$ref": "#/definitions/linkUrl"},
            {"description": "Link that offers more information related to the addon."}
          ]
        }
      },
      "required": ["title", "author", "icon", "amo_url"]
    },
    "text": {
      "description": "The body text displayed in the pop-over. This can be a reference to a localized string in Firefox or just a plain string.",
      "oneOf": [
        {
          "type": "string",
          "description": "Description message of the addon."
        },
        {
          "type": "object",
          "properties": {
            "string_id": {
              "type": "string",
              "description": "Id of string to localized addon description"
            }
          },
          "required": ["string_id"]
        }
      ]
    },
    "descriptionDetails": {
      "description": "Additional information and steps on how to use",
      "type": "object",
      "properties": {
        "steps": {
          "description": "Array of messages or string_ids",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "string_id": {
                "type": "string",
                "description": "Id of string to localized addon description"
              }
            },
            "required": ["string_id"]
          }
        }
      },
      "required": ["steps"]
    },
    "buttons": {
      "description": "The label and functionality for the buttons in the pop-over.",
      "type": "object",
      "properties": {
        "primary": {
          "type": "object",
          "properties": {
            "label": {
              "type": "object",
              "oneOf": [
                {
                  "properties": {
                    "value": {
                      "allOf": [
                        {"$ref": "#/definitions/plainText"},
                        {"description": "Button label override used when a localized version is not available."}
                      ]
                    },
                    "attributes": {
                      "type": "object",
                      "properties": {
                        "accesskey": {
                          "type": "string",
                          "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label."
                        }
                      },
                      "required": ["accesskey"],
                      "description": "Button attributes."
                    }
                  },
                  "required": ["value", "attributes"]
                },
                {
                  "properties": {
                    "string_id": {
                      "allOf": [
                        {"$ref": "#/definitions/plainText"},
                        {"description": "Id of localized string for button"}
                      ]
                    }
                  },
                  "required": ["string_id"]
                }
              ],
              "description": "Id of localized string or message override."
            },
            "action": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Action dispatched by the button."
                },
                "data": {
                  "properties": {
                    "url": {
                      "type": "null",
                      "$comment": "This is dynamically generated from the addon.id. See CFRPageActions.jsm",
                      "description": "URL used in combination with the primary action dispatched."
                    }
                  }
                }
              }
            }
          },
          "secondary": {
            "type": "object",
            "properties": {
              "label": {
                "type": "object",
                "oneOf": [
                  {
                    "properties": {
                      "value": {
                        "allOf": [
                          {"$ref": "#/definitions/plainText"},
                          {"description": "Button label override used when a localized version is not available."}
                        ]
                      },
                      "attributes": {
                        "type": "object",
                        "properties": {
                          "accesskey": {
                            "type": "string",
                            "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label."
                          }
                        },
                        "required": ["accesskey"],
                        "description": "Button attributes."
                      }
                    },
                    "required": ["value", "attributes"]
                  },
                  {
                    "properties": {
                      "string_id": {
                        "allOf": [
                          {"$ref": "#/definitions/plainText"},
                          {"description": "Id of localized string for button"}
                        ]
                      }
                    },
                    "required": ["string_id"]
                  }
                ],
                "description": "Id of localized string or message override."
              },
              "action": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "Action dispatched by the button."
                  },
                  "data": {
                    "properties": {
                      "url": {
                        "allOf": [
                          {"$ref": "#/definitions/linkUrl"},
                          {"description": "URL used in combination with the primary action dispatched."}
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "additionalProperties": false,
  "required": ["category", "bucket_id", "notification_text", "heading_text", "text", "buttons"]
}
